
$(document).ready(function(){
	cputemp();
	uptime();
	mem();
	
	

});

function mem(){
	$.get("/meminfo",function(data){
				var totalmem = data.totalmem;
				var freemem = data.freemem;
				var usemem =  totalmem - freemem;
				var percent =  (usemem / totalmem * 100).toFixed(1);
		
				$('#memDiv').attr("aria-valuemax",totalmem);
				$('#memDiv').attr("aria-valuenow",usemem);
				$('#memDiv').width(percent+"%");
				$('#memDiv').append("总内存："+ totalmem + "M" +   " 已用："+usemem+"M" + " 可用："+ freemem +"M");
		});
	}


function cputemp(){
		$.get("/cputemp", function(data){
				$('#cputemp').empty();
				$('#cputemp').append(data.cpuTemp+"℃");
});
}

$("#cputempBtn").click(function(){
		cputemp();
	});
	
$("#uploadBtn").click(function(){
		$("#uploadForm").submit();
	});



function uptime(){
		$.get("/uptime", function(data){
				$('#uptime').empty();
				$('#uptime').append(data.uptime);
});
}

$("#uptimeBtn").click(function(){
		uptime();
	});
